<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        *{
            margin: 0px;
            padding: 0px;
            list-style: none;
        }
        ul{
                overflow: hidden;
            }
            ul li{
                float: left;
                width: 100px;
                height: 30px;
                margin-right: 10px;
            }
            ul li:nth-of-type(1){
                background:orange;
            }
            section>div{
                width: 500px;
                height: 200px;
                text-align: center;
                line-height: 200px;
                display: none;
            }
            section>div:nth-of-type(1){
                display: block;
            }
    </style>
</head>
<body>
    <ul>
        <li>学习资料</li>
        <li>复习资料</li>
        <li>预习资料</li>
        <li>补课资料</li>
        <li>高级资料</li>
    </ul>
    <section>
        <div>资料</div>
        <div>花絮</div>
        <div>预告</div>
    </section>
    <script>
        var tags=document.getElementsByTagName('li');
        var boxs=document.getElementsByTagName('div');
        for(var i=0;i<tags.length;i++){
            tags[i].index=i;
            tags[i].onclick=function(){
                for(var j=0;j<tags.length;j++){
                tags[j].style.background="none";
                boxs[j].style.display="none"}
                this.style.background="red";
                var n=this.index;
                boxs[n].style.display='block'
                
            }
        }
    </script>
</body>
</html>